import { createSlice } from '@reduxjs/toolkit';

const initialState = {
  users: [],
  loading: false,
  filters: {
    searchQuery: '',
    role: undefined,
    status: undefined
  }
};

const userManagementSlice = createSlice({
  name: 'userManagement',
  initialState,
  reducers: {
    setUsers: (state, action) => {
      state.users = action.payload;
    },
    setLoading: (state, action) => {
      state.loading = action.payload;
    },
    setFilters: (state, action) => {
      state.filters = { ...state.filters, ...action.payload };
    }
  }
});

export const { setUsers, setLoading, setFilters } = userManagementSlice.actions;

export default userManagementSlice.reducer; 